package cn.iocoder.yudao.module.train.dal.mysql.viplevel;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.train.dal.dataobject.viplevel.VipLevelDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.train.controller.admin.viplevel.vo.*;

/**
 * 会员等级设定 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface VipLevelMapper extends BaseMapperX<VipLevelDO> {

    default PageResult<VipLevelDO> selectPage(VipLevelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VipLevelDO>()
                .likeIfPresent(VipLevelDO::getLevelName, reqVO.getLevelName())
                .eqIfPresent(VipLevelDO::getDuration, reqVO.getDuration())
                .eqIfPresent(VipLevelDO::getPrice, reqVO.getPrice())
                .likeIfPresent(VipLevelDO::getVipRights, reqVO.getVipRights())
                .eqIfPresent(VipLevelDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(VipLevelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VipLevelDO::getId));
    }


    default List<VipLevelDO> selectAll(VipLevelPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<VipLevelDO>()
                .likeIfPresent(VipLevelDO::getLevelName, reqVO.getLevelName())
                .eqIfPresent(VipLevelDO::getDuration, reqVO.getDuration())
                .eqIfPresent(VipLevelDO::getPrice, reqVO.getPrice())
                .likeIfPresent(VipLevelDO::getVipRights, reqVO.getVipRights())
                .eqIfPresent(VipLevelDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(VipLevelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VipLevelDO::getId));
    }
}
